//
// Created by lsm on 2021/3/18.
//

#include "reveal.h"
#include <cstdio>
#include <cstring>

//void reverse_by_swap(char *str, int n)
//{
//    for (int i = 0; i < n / 2; ++i)
//    {
//        char temp = *(str + i);
//        *(str + i) =  *(str + n - i);
//        *(str + n - i) = temp;
//    }
//    printf("%s \n", str);
//}

void reverse_by_swap(char *str, int n)
{
    char *begin = str;
    char *end = str + n - 1;
    while (begin < end)
    {
        char tmp = *begin;
        *begin = *end;
        *end = tmp;
        ++begin;
        --end;
    }
}